﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcBHXH.Common;

namespace MvcBHXH.Models
{
    class DonViBHModel
    {
        private DataClassesBHYTTNDataContext context;
        public DonViBHModel() 
        {
            context = Util.CreateInstance().DataContext();
        }

        public List<DonViBHModel> GetDonViBHModel()
        {
            var DonViBHModel = from fc in context.tbl_DonViBHs
                               select new 
                               { 
                                    fc.Ma_DonViBH,
                                    fc.Ten_DonViBH,
                                    fc.DiaChi,
                                    fc.DienThoai,
                                    fc.Email,
                                    fc.GhiChu,
                               };
            List<DonViBHModel> listDonViBHModel = new List<DonViBHModel>();
            DonViBHModel dvBHModel;
            foreach (var item in DonViBHModel)
            {
                dvBHModel = new DonViBHModel();
                dvBHModel.MaDonViBH = item.Ma_DonViBH;
                dvBHModel.TenDonViBH = item.Ten_DonViBH;
                dvBHModel.DiaChi = item.DiaChi;
                dvBHModel.DienThoai = item.DienThoai;
                dvBHModel.Email = item.Email;
                dvBHModel.GhiChu = item.GhiChu;
                listDonViBHModel.Add(dvBHModel);
            }
            return listDonViBHModel;
        }

        private string maDonViBH;

        public string MaDonViBH
        {
            get { return maDonViBH; }
            set { maDonViBH = value; }
        }
        private string tenDonViBH;

        public string TenDonViBH
        {
            get { return tenDonViBH; }
            set { tenDonViBH = value; }
        }
        private string diaChi;

        public string DiaChi
        {
            get { return diaChi; }
            set { diaChi = value; }
        }
        private string dienThoai;

        public string DienThoai
        {
            get { return dienThoai; }
            set { dienThoai = value; }
        }
        private string email;

        public string Email
        {
            get { return email; }
            set { email = value; }
        }
        private string ghiChu;

        public string GhiChu
        {
            get { return ghiChu; }
            set { ghiChu = value; }
        }

    }
}
